/* Shift-JIS */
/* UTF-8 */
/********************************************************************************/
/*ソース名:                                                                       */
/*　　core.h                                                                      */
/*機能:                                                                         */
/*　　 コアの処理のインターフェースを定義する　　　　　　　　　　　　　　　                                                                          */
/*作成者:                                                                       */
/*　　作成者：CBS　ト　2009/06/24                                                                                                                                       */
/********************************************************************************/
/*変更履歴:                                                                     */
/*　　作成者：CBS　ト　2009/06/24                                                   */
/********************************************************************************/
#ifndef __CORE_IF_H_
#define __CORE_IF_H_
#ifndef __TYPEDEF_FOR_ALL
#include "typedef.h"
#endif

/* 関数リターン値 */
#define COEXIT_SUCCESS  EXIT_SUCCESS
#define COEXIT_FILEEND  EXIT_FINISHED
#define COEXIT_FINISHED EXIT_FINISHED
#define COEXIT_WARNING  EXIT_WARNING
#define COEXIT_ERROR    EXIT_ERROR
#define COEXIT_FATAL    EXIT_FATAL
#define COEXIT_END      EXIT_END
#define COEXIT_NOTINIT  (EXIT_END+10)
#define COEXIT_NFOUND   (EXIT_END+11)
#define COEXIT_FOUND   (EXIT_END+12)

typedef struct __ALERT_MSG_PARAM {
	PSZ opt;
	PSZ param;
	struct __ALERT_MSG_PARAM * next;
} ALERT_MSG_PARAM;
/*
 * 0xF000    module
 *    1   file
 *    2   memory
 *    3   table
 *    4   cpp
 *    5   cppresult
 *    6   cc
 *    7   link
 * 0x0F00   sub-module
 *   cpp
 *    1  tokens
 *    2  ctrl
 *    3  if
 *    4  def
 *    5  error
 *    6  include
 *    7  line
 *    8  pragma
 *    9  replace
 *    A  location
 *    B  result
 *    C  option
 *  cc
 *    1. token
 *    2. decl
 *    3. statement
 *    4. exp
 *    5. calcute
 *    6. link
 *    7. asm
 *
 *
 */
enum _MSG_MODULE {
	mod_file = 1,
	mod_memory,
	mod_table,
	mod_cpp,
	mod_cpp_result,
	mod_cc,
	mod_link,
	mod_ast_trace,
	mod_cmd_trace,
	mod_max
};
enum _MSG_SUB_FILE {
	file_all = 1, file_max
};
enum _MSG_SUB_MEM {
	mem_all = 1, mem_max
};
enum _MSG_SUB_TAB {
	tab_all = 1, tab_max
};
enum _MSG_SUB_CPPRES {
	cpp_res_all = 1, cpp_res_max
};
enum _MSG_SUB_LINK {
	link_all = 1, link_max
};
enum _MSG_SUB_AST_TRACE {
	ast_trace_all = 1, ast_trace_max
};
enum _MSG_SUB_CMD_TRACE {
	cmd_trace_all = 1, cmd_trace_max
};
enum _MSG_SUB_CPP {
	cpp_sub_option = 1,
	cpp_sub_token,
	cpp_sub_if,
	cpp_sub_define,
	cpp_sub_error,
	cpp_sub_include,
	cpp_sub_line,
	cpp_sub_pragma,
	cpp_sub_replace,
	cpp_sub_max
};
enum _MSG_SUB_CC {
	cc_sub_option = 1,
	cc_sub_token,
	cc_sub_decl,
	cc_sub_statement,
	cc_sub_expression,
	cc_sub_initializer,
	cc_sub_calcute,
	cc_sub_link,
	cc_sub_asm,
	cc_sub_max
};
#define module_set(a)  ((a&0x0000000F)<<12)
#define submod_set(a)  ((a&0x0000000F)<<8)
#define module_get(a)  ((a&0x0000F000)>>12)
#define submod_get(a)  ((a&0x00000F00)>>8)

enum _MSG_FILEACCESS_LIST {
	FILE_TOOMANY = module_set(mod_file) | submod_set(file_all) | 1,
	FILE_CANNOTOPEN,
	FILE_CANNOTCLOSE,
	FILE_CANNOTREAD,
	FILE_CANNOTWRITE,
	/* write source here */
	FILE_MSG_END
};
enum _MSG_MEMORYACCESS_LIST {
	MEMORY_ERROR = module_set(mod_memory) | submod_set(mem_all) | 1,
	/* write source here */
	MEMORY_MSG_END
};
enum _MSG_TABLEACCESS_LIST {
	TABLE_NEW_MEM = module_set(mod_table) | submod_set(tab_all) | 1,
	TABLE_REALLOC_MEM,
	TABLE_FREE_MEM,
	TABLE_ALLOC_OVERFLOW,
	BUFFER_ALLOC_OVERFLOW,
	TABLE_ALLOC_UNDERFLOW,
	BUFFER_ALLOC_UNDERFLOW,
	TABLE_DATA_LOST,
	TABLE_LARGER_INDEX,
	TABLE_DATA_MISTAKE,
	/* write source here */
	TABLE_MSG_END
};
enum _MSG_CPP_OPTION {
	CPP_OPT_WRONG = module_set(mod_cpp) | submod_set(cpp_sub_option) | 1,
	CPP_OPT_SHOULD_HAS_NOPARAM,
	CPP_OPT_SHOULD_HAS_PARAM,
	CPP_OPT_ILLEGAL_PARAM,
	/* write source here */
	CPP_OPT_MSG_END
};
enum _MSG_CPP_TOKEN {
	CPP_SRC_NEXTLINE_NOTFOUND = module_set(mod_cpp) | submod_set(cpp_sub_token)
			| 1,
	CPP_COMMENT_NOTEND,
	CPP_COMMAND_VSPACE_FOUND,
	CPP_COMMAND_KEYWORD_ILLEGAL,
	CPP_PPTOKEN_CHAR_NOTEND,
	CPP_PPTOKEN_HEADER_NOTEND,
	CPP_PPTOKEN_STRLITER_NOTEND,
	CPP_PPTOKEN_INVALID,
	/* write source here */
	CPP_PPTOKEN_MSG_END
};
enum _MSG_CPP_IF {
	CPP_CONDEXP_SYNTAX_ILLEGAL = module_set(mod_cpp) | submod_set(cpp_sub_if)
			| 1,
	CPP_CONDEXP_TYPE_ILLEGAL,
	CPP_CONDEXP_TOKEN_ILLEGAL, /* 1.token */
	CPP_IF_NONE_CONDEXP,
	CPP_IF_CONDEXP_OPERATOR_ILLEGAL,
	CPP_IF_CONDEXP_OVERFLOW,
	CPP_IF_CONDEXP_DIV_ZERO,
	CPP_CONDEXP_UNDEF_SYMBOL,
	CPP_IF_ENDIF_NOTFOUND,
	CPP_ELIF_IF_NOTFOUND,
	CPP_IFDEF_ENDIF_NOTFOUND,
	CPP_IFDEF_CONDEXP_FORMAT_ILLEGAL,
	CPP_IFDEF_TOKEN_USELESS,
	CPP_IFNDEF_ENDIF_NOTFOUND,
	CPP_IFNDEF_CONDEXP_FORMAT_ILLEGAL,
	CPP_IFNDEF_TOKEN_USELESS,
	CPP_ELSE_IF_NOTFOUND,
	CPP_ELSE_DUPLICATE,
	CPP_ELSE_DUPLICATE1ST,
	CPP_ELSE_TOKEN_USELESS,
	CPP_ENDIF_IF_NOTFOUND,
	CPP_ENDIF_TOKEN_USELESS,
	/* write source here */
	CPP_IF_MSG_END
};
enum _MSG_CPP_DEFINE {
	CPP_DEF_SSLEFT_NOTFOUND = module_set(mod_cpp) | submod_set(cpp_sub_define)
			| 1,
	CPP_DEF_SSRIGHT_NOTFOUND,
	CPP_DEF_SPARAM_ILLEGAL,
	CPP_DEF_PARAMFORMAT_ILLEGAL,
	CPP_DEF_PARAM_DUPLICATE,
	CPP_DEF_MACRONAME_NOTFOUND,
	CPP_DEF_MACRONAME_ILLEGAL,
	CPP_DEF_MACRONAME_FORBIDDEN,
	CPP_UND_MACRONAME_NOTFOUND,
	CPP_UND_MACRONAME_ILLEGAL,
	CPP_UND_MACRONAME_FORBIDDEN,
	CPP_UND_TOKEN_USELESS,
	CPP_DEF_MACRO_DUPLICATE,
	CPP_DEF_MACRO_DUPLICATE1ST,
	/* write source here */
	CPP_DEF_MSG_END
};
enum _MSG_CPP_ERROR {
	CPP_ERR_MESSAGE = module_set(mod_cpp) | submod_set(cpp_sub_error) | 1,
	/* write source here */
	CPP_ERR_MSG_END
};
enum _MSG_CPP_INCLUDE {
	CPP_INC_OVERFLOW_NESTLVL = module_set(mod_cpp) | submod_set(cpp_sub_include)
			| 1,
	CPP_INC_FORMAT_ILLEGAL,
	CPP_INC_HEADER_TOOLONG,
	CPP_INC_HEADER_INVALID,
	CPP_INC_FILE_NOTFOUND,
	CPP_INC_FILE_CANNOT_READ,
	/* write source here */
	CPP_INC_MSG_END
};
enum _MSG_CPP_LINE {
	CPP_LINE_FORMAT_ILLEGAL = module_set(mod_cpp) | submod_set(cpp_sub_line)
			| 1,
	CPP_LINE_LINENO_ILLEGAL,
	CPP_LINE_LINENO_OVERFLOW,
	CPP_LINE_FILEPATH_ILLEGAL,
	/* write source here */
	CPP_LINE_MSG_END
};
enum _MSG_CPP_PRAGMA {
	CPP_PRAGMA_ENDASM_NOTFOUND = module_set(mod_cpp)
			| submod_set(cpp_sub_pragma) | 1, CPP_PRAGMA_ASM_NOTFOUND,
	/* write source here */
	CPP_PRAGMA_MSG_END
};
enum _MSG_CPP_REPLACE {
	CPP_MACRO_COMMAND_INARG = module_set(mod_cpp) | submod_set(cpp_sub_replace)
			| 1,
	CPP_MACRO_FORMAT_ILLEGAL,
	CPP_MACRO_SSTOKEN_CANNOTMERGE,
	CPP_MACRO_ARGNUM_DIFF,
	CPP_MACRO_ARGNUM_DIFF_DEFLOC,
	CPP_MACRO_BLANK_ARG,
	/* write source here */
	CPP_MACRO_MSG_END
};
/*  CC  6 */
enum _MSG_CC_OPTION {
	CC_OPT_WRONG = module_set(mod_cc) | submod_set(cc_sub_option) | 1,
	CC_OPT_SHOULD_HAS_NOPARAM,
	CC_OPT_SHOULD_HAS_PARAM,
	CC_OPT_ILLEGAL_PARAM,
	/* write source here */
	CC_OPT_MSG_END
};
enum _MSG_CC_TOKEN {
	CC_TOKEN_UNEXPECTED = module_set(mod_cc) | submod_set(cc_sub_token) | 1,
	CC_TOKEN_STRING_KIND_DIFF,
	CC_TOKEN_STRING_HEX_ILLEGAL,
	CC_TOKEN_STRING_HEX_OVERFLOW,
	CC_TOKEN_STRING_OCT_OVERFLOW,
	CC_TOKEN_STRING_OCT_ILLEGAL,
	CC_TOKEN_CHAR_UNKNOWN_ESCAPE,
	CC_TOKEN_NUMBER_HEX_OVERFLOW,
	CC_TOKEN_NUMBER_HEX_ILLEGAL,
	CC_TOKEN_NUMBER_OCT_OVERFLOW,
	CC_TOKEN_NUMBER_OCT_ILLEGAL,
	CC_TOKEN_NUMBER_FLOAT_ILLEGAL,
	CC_TOKEN_NUMBER_OVERFLOW,/*  1. token */
	CC_TOKEN_NUMBER_ILLEGAL,
	CC_TOKEN_CHAR_BLANK,
	CC_TOKEN_CHAR_HEX_ILLEGAL,
	CC_TOKEN_CHAR_HEX_OVERFLOW, /*  1. token */
	CC_TOKEN_CHAR_OCT_OVERFLOW,/*  1. token */
	CC_TOKEN_CHAR_OCT_ILLEGAL,
	CC_TOKEN_CHAR_MULTIBYTE,
	CC_TOKEN_CHAR_MULTICHAR,/*  1. token */
	/* write source here */
	CC_TOKEN_MSG_END
};
enum _MSG_CC_DECLARATION {
	CC_DECL_SYNTAX_ERROR = module_set(mod_cc) | submod_set(cc_sub_decl) | 1,/* 1. token 2. null */
	CC_DECL_FUNC_PARAM_OVERLAP,
	CC_DECL_FUNC_OLDSTYLE_DECLIST_WRONGNAME, /* 1. name 2. NULL */
	CC_DECL_FUNC_OLDSTYLE_MISUSE, /* none */
	CC_DECL_FUNC_PARAM_NOTYPE, /* 1. parameter name 2. default type */
	CC_DECL_FUNC_PARAM_NOSIZE,
	CC_DECL_FUNC_PARAM_CLASS_ILLEGAL, /* 1. parameter name 2. null */
	CC_DECL_FUNC_PARAM_INITIALLED,
	CC_DECL_FUNC_PARAM_FORMAT_ILLEGAL, /* 1. token 2. null */
	CC_DECL_FUNC_PARAM_NONAME,/* 1. token 2. null */
	CC_DECL_FUNC_PARAM_DUPLICATE_TYPEDEF,/* 1. token 2. null */
	CC_DECL_FUNC_HAS_QUALIFIER,
	CC_DECL_EXTERN_FUNC_IN_FUNC,
	CC_DECL_FUNC_IN_FUNC,
	CC_DECL_FUNC_CLASS_ILLEGAL,/* 1. token 2. null */
	CC_DECL_FUNC_PARAM_CHANGEABLE, /* no parameter */
	CC_DECL_FUNC_CLASS_NEARPOINTER, /* 1. null 2. null */
	CC_DECL_FUNC_RETURNTYPE_ILLEGAL,/* 1. null 2. null */
	CC_DECL_FUNC_SYNTAX_ILLEGAL,/* 1. token 2. null */
	CC_DECL_MEMBER_OVERLAP,
	CC_DECL_MEMBER_1ST_NONAME, /* no parameter */
	CC_DECL_MEMBER_NOSIZE,/* 1. member */
	CC_DECL_MEMBER_BIT_NEED_CONSTANT,
	CC_DECL_MEMBER_BIT_0BIT_SYM,/* 1. token 2. null */
	CC_DECL_MEMBER_BIT_TYPE_ILLEGAL, /* no parameter */
	CC_DECL_MEMBER_BIT_WIDTH_ILLEGAL,/* 1. illegal value 2. value regards as */
	CC_DECL_MEMBER_BIT_WIDTH_OVERFLOW,/* 1. illegal value 2. max bit size of type  */
	CC_DECL_MEMBER_BIT_WIDTH_NONE,/* 1. "" 2. value regards as*/
	CC_DECL_MEMBER_HAS_STORAGECLASS,/* 1. token 2. null */
	CC_DECL_MEMBER_DUPLICATE_TYPEDEF,/* 1. token 2. null */
	CC_DECL_MEMBER_DUPLICATE_TYPEDEF1ST,/* 1. token 2. null */
	CC_DECL_STRUCT_NONAMED_MEMBER,/* no parameter */
	CC_DECL_ENUMCONST_OVERLAP,
	CC_DECL_ENUMCONST_OVERLAP_1ST,
	CC_DECL_ENUMCONST_INITEXP_WRONGTYPE, /* 1. enum constant name 2. null */
	CC_DECL_ENUMCONST_INITEXP_OVERFLOW,
	CC_DECL_INBLOCK_OVERLAP,
	CC_DECL_INBLOCK_OVERLAP1ST,
	CC_DECL_VARI_INBLOCK_EXTERN_INITIALLED,
	CC_DECL_VARI_TYPE_INCOMPLETE,/*  1. token 2. null */
	CC_DECL_TEMPORARY_DUPLICATE_TYPEDEF,/*  1. token 2. null */
	CC_DECL_TEMPORARY_DUPLICATE_TYPEDEF1ST,/*  1. token 2. null */
	CC_DECL_TAG_INBLOCK_OVERLAP,/* 1. tag 2. null */
	CC_DECL_TAG_INBLOCK_OVERLAP_1ST,/* 1. tag 2. null */
	CC_DECL_TAG_NOTFOUND, /*  1. tag 2. null */
	CC_DECL_CLASS_OVERLAP,/*  1. null 2. null */
	CC_DECL_CLASS_NOT_GBLCLASS,/*  1. token 2. null */
	CC_DECL_QUALIFIER_OVERLAP,/*  1. token 2. null */
	CC_DECL_QUALIFIER_RESTRICT_MISSUSE,/*  1. token 2. null */
	CC_DECL_SPECIFIER_ILLEGAL, /*  1. token 2. null */
	CC_DECL_SPECIFIER_INEXISTENCE, /*  1. null 2. null */
	CC_DECL_SPECIFIER_NOTFOUND, /*  1. null 2. null */
	CC_DECL_TYPENAME_HASSYMBOL,/* 1. symbol 2. null */
	CC_DECL_TYPEDEF_SYM_INITIALLED, /* 1. symbol 2. null */
	CC_DECL_ARRAY_ORITYPE_FUNC,/* 1. null 2. null */
	CC_DECL_ARRAY_ORITYPE_INCOMPLETE,
	CC_DECL_ARRAY_INDEX_NOTINTEGER,/* 1. value  2. value that's default */
	CC_DECL_ARRAY_INDEX_NEGATIVE, /* 1.negative value  2. value that's default */
	CC_DECL_ARRAY_CLASS_REGISTER,
	CC_DECL_DECLARE_NOTHING,
	/* write source here */
	CC_DECL_MSG_END
};
enum _MSG_CC_STATEMENT {
	CC_STMT_SYNTAX_ERROR = module_set(mod_cc) | submod_set(cc_sub_statement)
			| 1,/* 1. token 2. null */
	CC_STMT_INBLOCK_DEC_AFTER_STMT,
	CC_STMT_FOR_INITEXP_DECL,
	CC_STMT_UNKNOWN_KEYWORD,
	CC_STMT_NEED_BODY,/* 1.  stmt kind 2. null */
	CC_STMT_CONTINUE_OUTLOOP,
	CC_STMT_BREAK_OUTLOOP_OR_SWITCH,
	CC_STMT_CASE_OUTSWITCH,
	CC_STMT_CASE_NEED_VALUE,
	CC_STMT_CASE_NEED_CONSTANT,
	CC_STMT_CASE_NEED_INTEGER,
	CC_STMT_CASE_OVERLAP,
	CC_STMT_CASE_OVERLAP1ST,
	CC_STMT_DEFAULT_OUTSWITCH,
	CC_STMT_DEFAULT_OVERLAP,
	CC_STMT_DEFAULT_OVERLAP1ST,
	CC_STMT_CONDEXP_NEED_SCALAR, /* 1. stmt kind 2. null */
	CC_STMT_CONDEXP_NEED_INTEGER, /* 1. stmt kind 2. null */
	CC_STMT_LABEL_OVERLAP,/* 1.  token 2. null */
	CC_STMT_LABEL_OVERLAP1ST,/* 1. token 2. null */
	CC_STMT_NEED_SYMBOL,
	CC_STMT_RETURN_VALUE_ILLEGAL,/* 1. null 2. null */
	/* write source here */
	CC_STMT_MSG_END
};
enum _MSG_CC_EXPRESSION {
	CC_EXP_SYNTAX_ERROR = module_set(mod_cc) | submod_set(cc_sub_expression)
			| 1,/* 1. token 2. null */
	CC_EXP_IDENTIFIER_UNKNOWN, /* 1. symbol name */
	CC_EXP_SIZEOF_TYPE_FUNC,
	CC_EXP_SIZEOF_TYPE_BIT,
	CC_EXP_SIZEOF_TYPE_NOSIZE,
	CC_EXP_OP_ERROR, /* 1. op name 2. null */
	CC_EXP_FORMAT_ERROR, /* 1. op name 2. null */
	CC_EXP_VARI_MULTIASSIGN,
	CC_EXP_OPERANDTYPE_NEED_INTEGER,
	CC_EXP_OPERANDTYPE_NEED_ARITH,
	CC_EXP_OPERANDTYPE_ILLEGAL_ADD,
	CC_EXP_OPERANDTYPE_ILLEGAL_SUB,
	CC_EXP_OPERANDTYPE_NEED_POINTER,
	CC_EXP_OPERANDTYPE_NEED_STRUCT_UNION,
	CC_EXP_OPERANDTYPE_NEED_SAME_POINTER,
	CC_EXP_OPERANDTYPE_CANNOT_BE_FUNC,
	CC_EXP_OPERANDTYPE_CANNOT_BE_BIT,
	CC_EXP_OPERANDTYPE_NEED_SCALAR,
	CC_EXP_OPERANDTYPE_1ST_SCALAR,
	CC_EXP_OPERANDTYPE_NEED_SAME_TYPE,
	CC_EXP_ARGUMENT_NEED_ASSIGNABLE_TYPE,
	CC_EXP_OPERAND_NEED_MODIFIABLE,
	CC_EXP_OPERANDTYPE_NEED_FUNCTION,

	CC_EXP_FUNCCALL_PARAM_NUM_DIFF, /* no parameter */
	CC_EXP_ASSIGNMENT_DIFFPTR,
	CC_EXP_ASSIGNMENT_PTR_DIFFQUAL,
	CC_EXP_ASSIGNMENT_DIFFTYPE,
	CC_EXP_ASSIGNMENT_TYPE_DIFFQUAL,
	CC_EXP_OPERAND_ARRAY_REGISTER,
	CC_EXP_FUNCCALL_BEFORE_DECLARE,
	CC_EXP_STATEMENT_IN_EXP,
	CC_EXP_OPERAND_WRONGMEMBER,/* 1. member name */
	CC_EXP_OP_ADDRESS_OF_REGISTER,
	CC_EXP_OP_ADDRESS_OF_BIT,
	CC_EXP_OPERAND_ILLEGAL, /* 1. name  2.reason */
	/* write source here */
	CC_EXP_MSG_END

};
enum _MSG_CC_INITIALIZER {
	CC_INITEXP_SYNTAX_ERROR = module_set(mod_cc)
			| submod_set(cc_sub_initializer) | 1,
	CC_INITEXP_NEED_CONSTEXP,
	CC_INITEXP_DESIGNATION_NEED_CONST,
	CC_INITEXP_DESIGNATION_NEED_INTEGER,
	CC_INITEXP_DESIGNATION_NEED_POSITIVE,
	CC_INITEXP_DESIGNATION_OVERFLOW,
	CC_INITEXP_DESIGNATION_UNKNOWN_SYM,
	CC_INITEXP_DESIGNATION_MEM_MISSUSE,
	CC_INITEXP_DESIGNATION_ARRAY_MISSUSE,
	CC_INITEXP_EXCESS_BRACE,
	CC_INITEXP_NEED_BRACE,
	CC_INITEXP_EXCESS_ELEMENTS,
	CC_INITEXP_UNCOMPATIBABLE_TYPE,
	/* write source here */
	CC_INITEXP_MSG_END
};
enum _MSG_CC_CALCUTE {
	CC_CONSTEXP_CAL_DIV0 = module_set(mod_cc) | submod_set(cc_sub_calcute) | 1,
	CC_CONSTEXP_CAL_OVERFLOW,
	CC_CONSTEXP_CAST_FLOAT2INT_OVERFLOW,
	CC_CONSTEXP_CAST_FLOAT2FLOAT_OVERFLOW,
	CC_CONSTEXP_SHIFT_BIT_MINUS,
	CC_CONSTEXP_SHIFT_BIT_LARGER,
	/* write source here */
	CC_CONSTEXP_MSG_END
};
enum _MSG_CC_LINK {
	CC_SYMBOL_TYPE_DIFF = module_set(mod_cc) | submod_set(cc_sub_link) | 1,
	CC_SYMBOL_TYPE_DIFF1ST,
	CC_SYMBOL_NOSIZE,
	CC_SYMBOL_REDEFINITION,
	CC_SYMBOL_REDEFINITION1ST,
	CC_SYMBOL_NODEFINITION,
	CC_DECL_DOUBLE_LINKAGE,
	CC_DECL_DOUBLE_LINKAGE1ST,
	/* write source here */
	CC_LINK_MSG_END
};
enum _MSG_CC_ASM {
	CC_ASM_SYNTAX_ERROR = module_set(mod_cc) | submod_set(cc_sub_asm) | 1,
	CC_ASM_SKIPLINE,
	/* write source here */
	CC_ASM_MSG_END
};
enum _MSG_CPPRES_LIST {
	/* write source here */
	CPPRES_MSG_END = module_set(mod_cpp_result) | submod_set(cpp_res_all) | 1
};
enum _MSG_LINK_LIST {
	LINK_FUNCTION_TYPE_DIFF = module_set(mod_link) | submod_set(link_all) | 1,
	LINK_SYMBOL_TYPE_DIFF,
	LINK_SYMBOL_NOSIZE,
	LINK_FUNCTION_REDEFINITION,
	LINK_SYMBOL_REDEFINITION,
	LINK_FUNCTION_NODEFINITION,
	LINK_SYMBOL_NODEFINITION,
	/* write source here */
	LINK_MSG_END
};
enum _MSG_AST_TRACE {
	TR_AST_ENTRY_WRONG = module_set(mod_ast_trace) | submod_set(ast_trace_all)
			| 1,
	/* write source here */
	TR_AST_ENTRY_END
};
enum _MSG_CMD_TRACE {
	TR_CMD_ENTRY_WRONG = module_set(mod_cmd_trace) | submod_set(cmd_trace_all)
			| 1,
	/* write source here */
	TR_CMD_ENTRY_END
};
/***************Location ***************************/
typedef struct TAG_TYPE_CODE_SCOPE {
	AST (*getMax)(VOID);
	U4 (*getFilePath)(AST, PSZ, U4);
	/*debug,12/10/16,S*/
	AST (*getFileIndex)(AST);
	/*debug,12/10/16,E*/
	PSZ (*getLastSegmentName)(AST, U4);
	S4 (*getBeginLine)(AST);
	S4 (*getEndLine)(AST);
	U2 (*getBeginLineOffset)(AST);
	U2 (*getEndLineOffset)(AST);
} TYPE_CODE_SCOPE;
extern TYPE_CODE_SCOPE CCodeScope;
/*debug,12/10/16,S*/
typedef struct TAG_TYPE_FILE_INDEX{
	AST (*getMax)(VOID);
	U4 (*getFilePath)(AST, PSZ, U4);
	S4 (*getModifyTime)(AST);
	U4 (*getSize)(AST);
	BOOL (*isFolder)(AST);
	BOOL (*isExisted)(AST);
	AST (*getTransUnit)(AST);
}TYPE_FILE_INDEX;
extern TYPE_FILE_INDEX CFileIndex;
/*debug,12/10/16,E*/
/*************** CPP's output**************************/
#ifndef CPP_OUTPUT_FUNCTION
#define CPP_OUTPUT_FUNCTION
/* information of option */
typedef struct _TAG_TYPE_OPTIONS {
	AST (*getMax)(VOID);
	PSZ (*getOptCmd)(AST);
	BOOL (*hasParam)(AST);
	PSZ (*getOptParam)(AST);
} TYPE_OPTIONS;
extern TYPE_OPTIONS COptionInfo;
/* information of directives */
typedef struct _TAG_TYPE_DIRECTIVEINFO {
	AST (*getMax)(VOID);
	BOOL (*isDefine)(AST astIndex);
	BOOL (*isUndef)(AST astIndex);
	BOOL (*isInclude)(AST astIndex);
	BOOL (*isIf)(AST astIndex);
	BOOL (*isElif)(AST astIndex);
	BOOL (*isElse)(AST astIndex);
	BOOL (*isEndif)(AST astIndex);
	BOOL (*isIfdef)(AST astIndex);
	BOOL (*isIfndef)(AST astIndex);
	BOOL (*isLine)(AST astIndex);
	BOOL (*isError)(AST astIndex);
	BOOL (*isPragma)(AST astIndex);
	AST (*getCodeScp)(AST astIndex);
	AST (*define_getMacroInfo)(AST astIndex);
	PSZ (*define_getMacroName)(AST astIndex);
	AST (*undef_getMacroInfo)(AST astIndex);
	PSZ (*undef_getMacroName)(AST astIndex);
	PSZ (*include_getHeader)(AST astIndex);
	AST (*include_getFileIndex)(AST astIndex);
	AST (*if_getCondtionExp)(AST astIndex);
	BOOL (*if_isActived)(AST astIndex);
	AST (*elif_getCondtionExp)(AST astIndex);
	BOOL (*elif_isActived)(AST astIndex);
	BOOL (*else_isActived)(AST astIndex);
	PSZ (*ifdef_getLabel)(AST astIndex);
	BOOL (*ifdef_isActived)(AST astIndex);
	PSZ (*ifndef_getLabel)(AST astIndex);
	BOOL (*ifndef_isActived)(AST astIndex);
	S4 (*line_getLineNum)(AST astIndex);
	PSZ (*line_getPath)(AST astIndex);
	PSZ (*error_getMsg)(AST astIndex);
	PSZ (*pragma_getCommand)(AST astIndex);
} TYPE_DIRECTIVEINFO;
extern TYPE_DIRECTIVEINFO CDirectiveInfo;
/* information of macro definition */
typedef struct {
	AST (*getMax)(VOID);
	PSZ (*getMacroName)(AST astIndex);
	BOOL (*isValid)(AST astIndex);
	BOOL (*isFunctionMacro)(AST astIndex);
	BOOL (*isObjectMacro)(AST astIndex);
	S2 (*getParameterNum)(AST astIndex);
	BOOL (*hasVariableParameters)(AST astIndex);
	AST (*getFirstToken)(AST astIndex);
	AST (*getLastToken)(AST astIndex);
	AST (*getDirectiveInfo)(AST astIndex);
} TYPE_MACRODEFINFO;
extern TYPE_MACRODEFINFO CMacroInfo;

/* tokens of macro replacement list */
typedef struct {
	AST (*getMax)(VOID);
	U2 (*getIndexCnter)(AST astIndex);
	BOOL (*isParameter)(AST astIndex);
	BOOL (*isBeforeSharpSharp)(AST astIndex);
	BOOL (*isAfterSharpSharp)(AST astIndex);
	BOOL (*isAfterSharp)(AST astIndex);
	S2 (*getParamIndex)(AST astIndex);
	PSZ (*getTokenLabel)(AST astIndex);
	U2 (*getTokenKind)(AST astIndex);
	AST (*getCodeScp)(AST astIndex);
} TYPE_REPLACEMENTLIST;
extern TYPE_REPLACEMENTLIST CRepListToken;

/* condition expressions of #if or #elif */
typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isTypeDouble)(AST astIndex);
	BOOL (*isTypeUnsigned)(AST astIndex);
	BOOL (*isTypeSigned)(AST astIndex);
	DOUBLE (*getValueofDouble)(AST astIndex);
	U4 (*getValueofUnsigned)(AST astIndex);
	S4 (*getValueofsigned)(AST astIndex);
	AST (*getLeftNode)(AST astIndex);
	AST (*getRightNode)(AST astIndex);
	AST (*getCodeScp)(AST astIndex);
	U4 (*getOperatorKind)(AST astIndex);
} TYPE_PPCONDITION_EXPR;
extern TYPE_PPCONDITION_EXPR CPPCondExp;

/* the tokens of active codes */
typedef struct {
	AST (*getMax)(VOID);
	AST (*getCodeScp)(AST astIndex);
	PSZ (*getTokenLabel)(AST astIndex);
} TYPE_PPTOKENLIST;
extern TYPE_PPTOKENLIST CPPTokenList;

typedef struct {
	BOOL (*isIdentifier)(U4 operatorKind);
	BOOL (*isConstantNumber)(U4 operatorKind);
	BOOL (*isParentheseExp)(U4 operatorKind);
	BOOL (*isPostfixOp)(U4 operatorKind);
	BOOL (*isUnaryOp)(U4 operatorKind);
	BOOL (*isCastOp)(U4 operatorKind);
	BOOL (*isMultiplicativeOp)(U4 operatorKind);
	BOOL (*isAdditiveOp)(U4 operatorKind);
	BOOL (*isShiftOp)(U4 operatorKind);
	BOOL (*isRelationalOp)(U4 operatorKind);
	BOOL (*isEqualityOp)(U4 operatorKind);
	BOOL (*isBitwiseAndOp)(U4 operatorKind);
	BOOL (*isBitwiseExclusiveOrOp)(U4 operatorKind);
	BOOL (*isBitwiseInclusiveOrOp)(U4 operatorKind);
	BOOL (*isLogicalAndOp)(U4 operatorKind);
	BOOL (*isLogicalOrOp)(U4 operatorKind);
	BOOL (*isConditionalOp)(U4 operatorKind);
	BOOL (*isAssignmentOp)(U4 operatorKind);
	BOOL (*isCommaOp)(U4 operatorKind);
	PSZ (*CppGetOpLabel)(U4 operatorKind);
} TYPE_PPCONDEXPKIND;
extern TYPE_PPCONDEXPKIND CPPCondExpKind;

typedef struct {
	BOOL (*isArrayCall)(U4 operatorKind);
	BOOL (*isFunctionCall)(U4 operatorKind);
	BOOL (*isDot)(U4 operatorKind);
	BOOL (*isArrow)(U4 operatorKind);
	BOOL (*isPostIncrement)(U4 operatorKind);
	BOOL (*isPostDecrement)(U4 operatorKind);
	BOOL (*isCompoundLiterals)(U4 operatorKind);
} TYPE_PPPOSTFIXOP;
extern TYPE_PPPOSTFIXOP CPPPostfixOpKind;

typedef struct {
	BOOL (*isPreIncrement)(U4 operatorKind);
	BOOL (*isPreDecrement)(U4 operatorKind);
	BOOL (*isGetAddressOp)(U4 operatorKind);
	BOOL (*isIndirectionOp)(U4 operatorKind);
	BOOL (*isUnaryPlus)(U4 operatorKind);
	BOOL (*isUnaryMinus)(U4 operatorKind);
	BOOL (*isBitwiseNegation)(U4 operatorKind);
	BOOL (*isValueNegation)(U4 operatorKind);
	BOOL (*isSizeof)(U4 operatorKind);
} TYPE_PPUNARYOP;
extern TYPE_PPUNARYOP CPPUnaryOpKind;

typedef struct {
	BOOL (*isMultiplicative)(U4 operatorKind);
	BOOL (*isDivision)(U4 operatorKind);
	BOOL (*isRemainderOp)(U4 operatorKind);
} TYPE_PPMULTIPLICATIVEOP;
extern TYPE_PPMULTIPLICATIVEOP CPPMultiOpKind;

typedef struct {
	BOOL (*isAdditive)(U4 operatorKind);
	BOOL (*isSubtraction)(U4 operatorKind);
} TYPE_PPADDITIVEOP;
extern TYPE_PPADDITIVEOP CPPAdditiveOpKind;

typedef struct {
	BOOL (*isLeftShift)(U4 operatorKind);
	BOOL (*isRightShift)(U4 operatorKind);
} TYPE_PPSHIFTOP;
extern TYPE_PPSHIFTOP CPPShiftOpKind;

typedef struct {
	BOOL (*isGreaterOrEqual)(U4 operatorKind);
	BOOL (*isGreater)(U4 operatorKind);
	BOOL (*isLessOrEqual)(U4 operatorKind);
	BOOL (*isLess)(U4 operatorKind);
} TYPE_PPRELATIONALOP;
extern TYPE_PPRELATIONALOP CPPRelationalOpKind;

typedef struct {
	BOOL (*isEqualOp)(U4 operatorKind);
	BOOL (*isUnequalOp)(U4 operatorKind);
} TYPE_PPEQUALITYOP;
extern TYPE_PPEQUALITYOP CPPEqualityOpKind;

typedef struct {
	BOOL (*isQuestionOp)(U4 operatorKind);
	BOOL (*isColonOp)(U4 operatorKind);
} TYPE_PPCONDITIONOP;
extern TYPE_PPCONDITIONOP CPPConditionOpKind;

typedef struct {
	BOOL (*isAssignment)(U4 operatorKind);
	BOOL (*isMultiAssignOp)(U4 operatorKind);
	BOOL (*isDivisionAssignOp)(U4 operatorKind);
	BOOL (*isRemainderAssignOp)(U4 operatorKind);
	BOOL (*isAddAssignOp)(U4 operatorKind);
	BOOL (*isSubtractionAssignOp)(U4 operatorKind);
	BOOL (*isLeftShiftAssignOp)(U4 operatorKind);
	BOOL (*isRightShiftAssignOp)(U4 operatorKind);
	BOOL (*isBitAndAssignOp)(U4 operatorKind);
	BOOL (*isBitExOrAssignOp)(U4 operatorKind);
	BOOL (*isBitOrAssignOp)(U4 operatorKind);
} TYPE_PPASSIGNMENTOP;
extern TYPE_PPASSIGNMENTOP CPPAssignOpKind;

typedef struct __CPP_OUTPUT_FUNCTIONS {
	TYPE_DIRECTIVEINFO * CDirectiveInfo;
	TYPE_MACRODEFINFO * CMacroInfo;
	TYPE_REPLACEMENTLIST * CRepListToken;
	TYPE_PPCONDITION_EXPR * CPPCondExp;
	TYPE_PPTOKENLIST * CPPTokenList;
	TYPE_PPCONDEXPKIND * CPPCondExpKind;
	TYPE_PPPOSTFIXOP * OpKindPostfix;
	TYPE_PPUNARYOP * OpKindUnary;
	TYPE_PPMULTIPLICATIVEOP * OpKindMulti;
	TYPE_PPADDITIVEOP * OpKindAdditive;
	TYPE_PPSHIFTOP * OpKindShift;
	TYPE_PPRELATIONALOP * OpKindRelational;
	TYPE_PPEQUALITYOP * OpKindEquality;
	TYPE_PPCONDITIONOP * OpKindCondition;
	TYPE_PPASSIGNMENTOP * OpKindAssign;
} CPP_OUTPUT_FUNCTIONS;
extern const CPP_OUTPUT_FUNCTIONS CPPOutput;
#endif
#ifndef CC_OUTPUT_FUNCTION
#define CC_OUTPUT_FUNCTION
/*************************CC*******************************/
/**** information of declarations *************************/
typedef struct {
	AST (*getMax)(VOID);
	AST (*getTypeSpecifier)(AST astIndex);
	AST (*getDeclarator)(AST astIndex);
	AST (*getCodeScope)(AST astIndex);
	BOOL (*isTypename)(AST astIndex);
	BOOL (*isMember)(AST astIndex);
	BOOL (*isParameter)(AST astIndex);
	BOOL (*isOrdinaryDeclaration)(AST astIndex);
	AST (*getNextDeclaration)(AST astIndex);
} TYPE_DECLARATION;
extern TYPE_DECLARATION CDeclaration;
/**** information of type specifier *************************/
typedef struct {
	AST (*getMax)(VOID);
	AST (*getCodeScope)(AST astIndex);
	AST (*getDeclaration)(AST astIndex);
	U2 (*getRestrictNum)(AST astIndex);
	U2 (*getVolatileNum)(AST astIndex);
	U2 (*getConstNum)(AST astIndex);
	U2 (*getExternNum)(AST astIndex);
	U2 (*getStaticNum)(AST astIndex);
	U2 (*getAutoNum)(AST astIndex);
	U2 (*getTypedefNum)(AST astIndex);
	U2 (*getRegisterNum)(AST astIndex);
	U2 (*getInterruptNum)(AST astIndex);
	U2 (*getInlineNum)(AST astIndex);
	U2 (*getAsmNum)(AST astIndex);
	U2 (*getNearNum)(AST astIndex);
	U2 (*getFarNum)(AST astIndex);
	BOOL (*isBasicType)(AST astIndex);
	BOOL (*isUnion)(AST astIndex);
	BOOL (*isStruct)(AST astIndex);
	BOOL (*isEnum)(AST astIndex);
	BOOL (*isTypedefIdentifier)(AST astIndex);
	AST (*getMemDeclarationList)(AST astIndex);
	AST (*getTagOrTypedefIdentifier)(AST astIndex);
	AST (*getTypeInfo)(AST astIndex);
} TYPE_TYPESPECIFIER;
extern TYPE_TYPESPECIFIER CTypeSpecifier;
/**** information of declarator *************************/
typedef struct {
	AST (*getMax)(VOID);
	AST (*getNextDeclarator)(AST astIndex);
	AST (*getParentDeclarator)(AST astIndex);
	AST (*getDeclaration)(AST astIndex);
	BOOL (*isPointerDeclarator)(AST astIndex);
	BOOL (*isParentheseDeclarator)(AST astIndex);
	BOOL (*isArrayDeclarator)(AST astIndex);
	BOOL (*isFunctionDeclarator)(AST astIndex);
	BOOL (*isSymbolDeclarator)(AST astIndex);
	BOOL (*isBitfieldDeclarator)(AST astIndex);
	BOOL (*isInitialExpDeclarator)(AST astIndex);
	AST (*bitfield_getConstExp)(AST astIndex);
	AST (*array_getArrayIndex)(AST astIndex);
	AST (*function_getParamChain)(AST astIndex);
	AST (*initExp_getInitExp)(AST astIndex);
	AST (*symbol_getSymbol)(AST astIndex);
	U2 (*pointer_getVolatileNum)(AST astIndex);
	U2 (*pointer_getConstNum)(AST astIndex);
	U2 (*pointer_getRestrictNum)(AST astIndex);
	AST (*getChildDeclarator)(AST astIndex);
	AST (*getType)(AST astIndex);
	AST (*getCodeScope)(AST astIndex);
} TYPE_DECLARATOR;
extern TYPE_DECLARATOR CDeclarator;
/**** information of statement *************************/
typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isBlock)(AST astIndex);
	BOOL (*isExpression)(AST astIndex);
	BOOL (*isIf)(AST astIndex);
	BOOL (*isFor)(AST astIndex);
	BOOL (*isWhile)(AST astIndex);
	BOOL (*isDo)(AST astIndex);
	BOOL (*isSwitch)(AST astIndex);
	BOOL (*isLabel)(AST astIndex);
	BOOL (*isCase)(AST astIndex);
	BOOL (*isDefault)(AST astIndex);
	BOOL (*isGoto)(AST astIndex);
	BOOL (*isBreak)(AST astIndex);
	BOOL (*isContinue)(AST astIndex);
	BOOL (*isReturn)(AST astIndex);
	BOOL (*isDecl)(AST astIndex);

	/*debug,12/11/14,S*/
	AST (*dec_getDeclaration)(AST astIndex);
	/*debug,12/11/14,E*/

	AST (*for_getInit_Decl)(AST astIndex);
	AST (*for_getInitExp)(AST astIndex);
	AST (*for_getCondExp)(AST astIndex);
	AST (*for_getIncExp)(AST astIndex);
	AST (*for_getBody)(AST astIndex);

	AST (*label_getLabelInfo)(AST astIndex);
	AST (*label_getStatement)(AST astIndex);
	AST (*label_getGotoChain)(AST astIndex);

	AST (*case_getConstExp)(AST astIndex);
	AST (*case_getNextCase)(AST astIndex);
	AST (*case_getStatement)(AST astIndex);
	AST (*case_getSwitch)(AST astIndex);

	AST (*default_getStatement)(AST astIndex);
	AST (*default_getSwitch)(AST astIndex);

	AST (*block_getChain)(AST astIndex);

	AST (*expStatement_getExp)(AST astIndex);

	AST (*if_getCondExp)(AST astIndex);
	AST (*if_getBody)(AST astIndex);
	AST (*if_getElseBody)(AST astIndex);

	AST (*switch_getCondExp)(AST astIndex);
	AST (*switch_getBody)(AST astIndex);
	AST (*switch_getFirstCase)(AST astIndex);
	AST (*switch_getDefault)(AST astIndex);

	AST (*while_getCondExp)(AST astIndex);
	AST (*while_getBody)(AST astIndex);

	AST (*do_getBody)(AST astIndex);
	AST (*do_getCondExp)(AST astIndex);

	AST (*goto_getLabelInfo)(AST astIndex);
	AST (*goto_getLabelStatement)(AST astIndex);

	AST (*continue_getLoop)(AST astIndex);

	AST (*break_getLoopOrSwitch)(AST astIndex);

	AST (*return_getExp)(AST astIndex);

	AST (*getCodeScope)(AST astIndex);
	BOOL (*isParentExp)(AST astIndex);
	BOOL (*isParentStmt)(AST astIndex);
	BOOL (*isParentSymbol)(AST astIndex);
	AST (*parent_GetExp)(AST astIndex);
	AST (*parent_GetStmt)(AST astIndex);
	AST (*parent_GetSymbol)(AST astIndex);
	AST (*getNextStmt)(AST astIndex);
	AST (*getBeforeStmt)(AST astIndex);
} TYPE_STATEMENTINFO;
extern TYPE_STATEMENTINFO CStatement;

typedef struct {
	AST (*getMax)(VOID);
	U4 (*getOpKind)(AST astIndex);
	AST (*getPrimaryConstValue)(AST astIndex);
	AST (*getPrimaryConstString)(AST astIndex);
	AST (*getPrimaryDeclaration)(AST astIndex);
	AST (*getPrimarySymbol)(AST astIndex);
	AST (*getPrimaryStatement)(AST astIndex);
	AST (*getPrimaryInitializer)(AST astIndex);
	AST (*getTypeInfo)(AST astIndex);
	AST (*getCastedTypeInfo)(AST astIndex);
	AST (*getCalcuteValue)(AST astIndex);
	AST (*getCodeScope)(AST astIndex);
	BOOL (*isIllegalExp)(AST astIndex);
	BOOL (*isLValue)(AST astIndex);
	BOOL (*isModifiable)(AST astIndex);
	BOOL (*isConstantExp)(AST astIndex);
	BOOL (*isAddressConstantExp)(AST astIndex);
	BOOL (*isParentExp)(AST astIndex);
	BOOL (*isParentStatement)(AST astIndex);
	BOOL (*isParentExpList)(AST astIndex);
	BOOL (*isParentDeclarator)(AST astIndex);
	BOOL (*isParentDesignation)(AST astIndex);
	AST (*parent_getExp)(AST astIndex);
	AST (*parent_getStatement)(AST astIndex);
	AST (*parent_getExpList)(AST astIndex);
	AST (*parent_getDeclarator)(AST astIndex);
	AST (*parent_getDesignation)(AST astIndex);
	AST (*getLeftNode)(AST astIndex);
	AST (*getRightNode)(AST astIndex);
} TYPE_EXPRESSIONINFO;
extern TYPE_EXPRESSIONINFO CExpression;

typedef struct {
	BOOL (*isConstantNumber)(U4 operatorKind);
	BOOL (*isIdentifier)(U4 operatorKind);
	BOOL (*isConstString)(U4 operatorKind);
	BOOL (*isParentheseExp)(U4 operatorKind);
	BOOL (*isDeclaration)(U4 operatorKind);
	BOOL (*isStatement)(U4 operatorKind);
	BOOL (*isInitializer)(U4 operatorKind);
	BOOL (*isPostfixOp)(U4 operatorKind);
	BOOL (*isUnaryOp)(U4 operatorKind);
	BOOL (*isCastOp)(U4 operatorKind);
	BOOL (*isMultiplicativeOp)(U4 operatorKind);
	BOOL (*isAdditiveOp)(U4 operatorKind);
	BOOL (*isShiftOp)(U4 operatorKind);
	BOOL (*isRelationalOp)(U4 operatorKind);
	BOOL (*isEqualityOp)(U4 operatorKind);
	BOOL (*isBitwiseAndOp)(U4 operatorKind);
	BOOL (*isBitwiseExclusiveOrOp)(U4 operatorKind);
	BOOL (*isBitwiseInclusiveOrOp)(U4 operatorKind);
	BOOL (*isLogicalAndOp)(U4 operatorKind);
	BOOL (*isLogicalOrOp)(U4 operatorKind);
	BOOL (*isConditionalOp)(U4 operatorKind);
	BOOL (*isAssignmentOp)(U4 operatorKind);
	BOOL (*isCommaOp)(U4 operatorKind);
	BOOL (*isArgumentDelimiter)(U4 operatorKind);
	PSZ (*CcGetOpLabel)(U4 operatorKind);
} TYPE_EXPRESSIONKIND;
extern TYPE_EXPRESSIONKIND CExpressionOpKind;

typedef struct {
	BOOL (*isArrayCall)(U4 operatorKind);
	BOOL (*isFunctionCall)(U4 operatorKind);
	BOOL (*isDot)(U4 operatorKind);
	BOOL (*isArrow)(U4 operatorKind);
	BOOL (*isPostIncrement)(U4 operatorKind);
	BOOL (*isPostDecrement)(U4 operatorKind);
	BOOL (*isCompoundLiterals)(U4 operatorKind);
} TYPE_POSTFIXOP;
extern TYPE_POSTFIXOP CPostfixOpKind;

typedef struct {
	BOOL (*isPreIncrement)(U4 operatorKind);
	BOOL (*isPreDecrement)(U4 operatorKind);
	BOOL (*isGetAddressOp)(U4 operatorKind);
	BOOL (*isIndirectionOp)(U4 operatorKind);
	BOOL (*isUnaryPlus)(U4 operatorKind);
	BOOL (*isUnaryMinus)(U4 operatorKind);
	BOOL (*isBitwiseNegation)(U4 operatorKind);
	BOOL (*isValueNegation)(U4 operatorKind);
	BOOL (*isSizeof)(U4 operatorKind);
} TYPE_UNARYOP;
extern TYPE_UNARYOP CUnaryOpKind;

typedef struct {
	BOOL (*isMultiplicative)(U4 operatorKind);
	BOOL (*isDivision)(U4 operatorKind);
	BOOL (*isRemainderOp)(U4 operatorKind);
} TYPE_MULTIPLICATIVEOP;
extern TYPE_MULTIPLICATIVEOP CMultiOpKind;

typedef struct {
	BOOL (*isAdditive)(U4 operatorKind);
	BOOL (*isSubtraction)(U4 operatorKind);
} TYPE_ADDITIVEOP;
extern TYPE_ADDITIVEOP CAdditiveOpKind;

typedef struct {
	BOOL (*isLeftShift)(U4 operatorKind);
	BOOL (*isRightShift)(U4 operatorKind);
} TYPE_SHIFTOP;
extern TYPE_SHIFTOP CShiftOpKind;

typedef struct {
	BOOL (*isGreaterOrEqual)(U4 operatorKind);
	BOOL (*isGreater)(U4 operatorKind);
	BOOL (*isLessOrEqual)(U4 operatorKind);
	BOOL (*isLess)(U4 operatorKind);
} TYPE_RELATIONALOP;
extern TYPE_RELATIONALOP CRelationalOpKind;

typedef struct {
	BOOL (*isEqualOp)(U4 operatorKind);
	BOOL (*isUnequalOp)(U4 operatorKind);
} TYPE_EQUALITYOP;
extern TYPE_EQUALITYOP CEqualityOpKind;
typedef struct {
	BOOL (*isQuestionOp)(U4 operatorKind);
	BOOL (*isColonOp)(U4 operatorKind);
} TYPE_CONDITIONOP;
extern TYPE_CONDITIONOP CConditionOpKind;
typedef struct {
	BOOL (*isAssignment)(U4 operatorKind);
	BOOL (*isMultiAssignOp)(U4 operatorKind);
	BOOL (*isDivisionAssignOp)(U4 operatorKind);
	BOOL (*isRemainderAssignOp)(U4 operatorKind);
	BOOL (*isAddAssignOp)(U4 operatorKind);
	BOOL (*isSubtractionAssignOp)(U4 operatorKind);
	BOOL (*isLeftShiftAssignOp)(U4 operatorKind);
	BOOL (*isRightShiftAssignOp)(U4 operatorKind);
	BOOL (*isBitAndAssignOp)(U4 operatorKind);
	BOOL (*isBitExOrAssignOp)(U4 operatorKind);
	BOOL (*isBitOrAssignOp)(U4 operatorKind);
} TYPE_ASSIGNMENTOP;
extern TYPE_ASSIGNMENTOP CAssignOpKind;

/******** type information ****************/
typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isBasicType)(AST astIndex);
	BOOL (*isArray)(AST astIndex);
	BOOL (*isPointer)(AST astIndex);
	BOOL (*isFunction)(AST astIndex);
	BOOL (*isStruct)(AST astIndex);
	BOOL (*isUnion)(AST astIndex);
	BOOL (*isEnum)(AST astIndex);
	BOOL (*isBitfield)(AST astIndex);
	BOOL (*isSigned)(AST astIndex);
	BOOL (*isUnSigned)(AST astIndex);
	BOOL (*isLongLong)(AST astIndex);
	BOOL (*isLong)(AST astIndex);
	BOOL (*isShort)(AST astIndex);
	BOOL (*isInteger)(AST astIndex);
	BOOL (*isFloating)(AST astIndex);
	BOOL (*isConst)(AST astIndex);
	BOOL (*isVolatile)(AST astIndex);
	BOOL (*isRestrict)(AST astIndex);
	U4 (*getTypeSize)(AST astIndex);
	AST (*getElementType)(AST astIndex);
	AST (*getNoneQualifierType)(AST astIndex);
	AST (*getMemberChain)(AST astIndex);
	AST (*getTagInfo)(AST astIndex);
	PSZ (*getBasicTypeName)(AST astIndex);
} TYPE_TYPEINFO;
extern TYPE_TYPEINFO CTypeInfo;

/******** symbol information ****************/
typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isExtern)(AST astIndex);
	BOOL (*isStatic)(AST astIndex);
	BOOL (*isRegister)(AST astIndex);
	BOOL (*isAuto)(AST astIndex);
	BOOL (*isTypedefId)(AST astIndex);
	BOOL (*isEnumConstant)(AST astIndex);
	BOOL (*isFunction)(AST astIndex);
	BOOL (*isVariable)(AST astIndex);
	BOOL (*isMember)(AST astIndex);
	BOOL (*isParameter)(AST astIndex);
	BOOL (*isTag)(AST astIndex);
	BOOL (*isLabel)(AST astIndex);
	AST (*getType)(AST astIndex);
	AST (*getLinkage)(AST astIndex);
	BOOL (*bReferred)(AST astIndex);
	PSZ (*getName)(AST astIndex);
	AST (*getCodeScope)(AST astIndex);
	AST (*getFunctionBody)(AST astIndex);
	AST (*getDataSection)(AST astIndex);
	AST (*getInitExp)(AST astIndex);
	AST (*getInitValue)(AST astIndex);
	AST (*getMemberOffsetBytes)(AST astIndex);
} TYPE_SYMBOLINFO;
extern TYPE_SYMBOLINFO CSymbol;

typedef struct _INTVALUE_8 {
	SCHAR sign;
	U8 u8Remainder; /* Absolute value */
} INTVALUE;
typedef struct {
	AST (*getMax)(VOID);
	AST (*getType)(AST astIndex);
	BOOL (*isFloating)(AST astIndex);
	INTVALUE (*getIntegerValue)(AST astIndex);
	DOUBLE (*getFloatingValue)(AST astIndex);
} TYPE_VALUEINFO;
extern TYPE_VALUEINFO CValueInfo;

typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isConstatnt)(AST);
	BOOL (*isAddressConstant)(AST);
	BOOL (*isParentDeclarator)(AST);
	BOOL (*isParentExpression)(AST);
	BOOL (*isParentInitializer)(AST);
	BOOL (*isBlockInitializer)(AST);
	AST (*getChildInitializer)(AST);
	BOOL (*isExpInitializer)(AST);
	AST (*getExpression)(AST);

	AST (*getDesignation)(AST);

	AST (*getNextOne)(AST);
	AST (*getCodeScope)(AST);
	AST (*parent_getDeclarator)(AST);
	AST (*parent_getExpression)(AST);
	AST (*parent_getInitializer)(AST);
} TYPE_INITIALIZER;
extern TYPE_INITIALIZER CInitializer;
typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isMember)(AST);
	BOOL (*isArray)(AST);
	AST (*getArrayIndex)(AST);
	AST (*getMemberSymbol)(AST);
	AST (*getChild)(AST);
	AST (*getParent)(AST);
	AST (*getCodeScope)(AST);
	AST (*getInitializer)(AST);
} TYPE_INITDESIGNATION;
extern TYPE_INITDESIGNATION CDesignation;
/***** unite chain *********************/
/****
 * chain of members list
 * chain of parameters list
 * chain of statements
 * chain of declarations
 */
typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isSymbolInfo)(AST astIndex);
	BOOL (*isStatement)(AST astIndex);
	BOOL (*isDeclarations)(AST astIndex);
	AST (*getSymbol)(AST astIndex);
	AST (*getStatement)(AST astIndex);
	AST (*getDeclaration)(AST astIndex);
	AST (*getPreOne)(AST astIndex);
	AST (*getNextOne)(AST astIndex);
} TYPE_UNITECHAIN;
extern TYPE_UNITECHAIN CUniteChain;

/***** inner linkage *********************/
typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isExternal)(AST astIndex);
	BOOL (*isReferred)(AST astIndex);
	AST (*getAllSymbols)(AST astIndex);
	AST (*getTenSymbols)(AST astIndex);
	AST (*getDefinitions)(AST astIndex);
	AST (*getDefSymbol)(AST astIndex);
} TYPE_CCLINKAGE;
extern TYPE_CCLINKAGE CLinkage;

/***** translation unit *********************/
typedef struct {
	AST (*getMax)(VOID);
	AST (*getDeclaration)(AST astIndex);
	/*debug,12/12/18,S*/
	AST (*getFileIndex)(AST index);
	AST (*getVari)(AST index);
	AST (*getFunc)(AST index);
	AST (*getLinkage)(AST index);
	/*debug,12/12/18,E*/
} TYPE_TRANSLATIONUNIT;
extern TYPE_TRANSLATIONUNIT CTranslationUnit;
typedef struct {
	PSZ (*getString)(AST);
	S4 (*getLength)(AST);
} TYPE_STRINGS;
extern TYPE_STRINGS CStrings;
typedef struct _CC_OUTPUT_FUNCTIONS {
	TYPE_DECLARATION *CDeclaration;
	TYPE_TYPESPECIFIER * CTypeSpecifier;
	TYPE_DECLARATOR * CDeclarator;
	TYPE_STATEMENTINFO * CStatement;
	TYPE_EXPRESSIONINFO * CExpression;
	TYPE_EXPRESSIONKIND * CExpressionOpKind;
	TYPE_POSTFIXOP * CPostfixOpKind;
	TYPE_UNARYOP * CUnaryOpKind;
	TYPE_MULTIPLICATIVEOP * CMultiOpKind;
	TYPE_ADDITIVEOP * CAdditiveOpKind;
	TYPE_SHIFTOP * CShiftOpKind;
	TYPE_RELATIONALOP * CRelationalOpKind;
	TYPE_EQUALITYOP * CEqualityOpKind;
	TYPE_CONDITIONOP * CConditionOpKind;
	TYPE_ASSIGNMENTOP * CAssignOpKind;
	TYPE_TYPEINFO * CTypeInfo;
	TYPE_SYMBOLINFO * CSymbol;
	TYPE_VALUEINFO * CValueInfo;
	TYPE_UNITECHAIN * CUniteChain;
	TYPE_CCLINKAGE * CLinkage;
	TYPE_TRANSLATIONUNIT *CTranslationUnit;
	TYPE_STRINGS *CStrings;
} CC_OUTPUT_FUNCTIONS;
extern const CC_OUTPUT_FUNCTIONS CCOutput;
#endif
/***** translation unit *********************/
//extern  TYPE_TRANSLATIONUNIT LinkTranslationUnit;
extern TYPE_STRINGS LinkStrings;

typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isRegister)(AST);
	AST (*getType)(AST astIndex);
	PSZ (*getName)(AST astIndex);
	AST (*getCodeScope)(AST astIndex);
	AST (*getValue)(AST astIndex);
	S4 (*getOffsetSize)(AST astIndex);
	AST (*getNextMember)(AST astIndex);
} TYPE_MEMBERINFO;
extern TYPE_MEMBERINFO LinkMember;

typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isNegative)(AST);
	BOOL (*isSigned)(AST);
	BOOL (*isFloating)(AST);
	U4 (*getSize)(AST);
	INTVALUE (*getInteger)(AST);
	DOUBLE (*getFloating)(AST);
} TYPE_CONSTANTINFO;
extern TYPE_CONSTANTINFO LinkConstant;
typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isExternal)(AST astIndex);
	BOOL (*isReferred)(AST astIndex);
	BOOL (*isFunction)(AST astIndex);
	AST (*getParameter)(AST astIndex);
} TYPE_GBLLINKAGE;
extern TYPE_GBLLINKAGE LinkLinkage;

typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isExtern)(AST astIndex);
	BOOL (*isStatic)(AST astIndex);
	BOOL (*isRegister)(AST astIndex);
	BOOL (*isAuto)(AST astIndex);
	AST (*getType)(AST astIndex);
	AST (*getLinkage)(AST astIndex);
	PSZ (*getName)(AST astIndex);
	AST (*getCodeScope)(AST astIndex);
	AST (*getInitializerBegin)(AST astIndex);
	AST (*getInitializerEnd)(AST astIndex);
	PSZ (*getDataSection)(AST astIndex);
	U4 (*getMemberOffsetBytes)(AST astIndex);
	U4 (*getVariableLength)(AST astIndex);
	BOOL (*isVariableSize)(AST astIndex);
	AST (*getChild)(AST astIndex);
	AST (*getParent)(AST astIndex);
	AST (*getNext)(AST astIndex);
	AST (*getPrev)(AST astIndex);
} TYPE_VARIABLE;
extern TYPE_VARIABLE LinkVariable;

typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isExtern)(AST astIndex);
	BOOL (*isStatic)(AST astIndex);
	AST (*getLinkage)(AST astIndex);
	AST (*getType)(AST astIndex);
	PSZ (*getName)(AST astIndex);
	AST (*getFunctionEntry)(AST astIndex);
	AST (*getFunctionExit)(AST astIndex);
	AST (*getCodeScope)(AST astIndex);
} TYPE_FUNCTION;
extern TYPE_FUNCTION LinkFunction;

typedef struct {
	AST (*getMax)(VOID);
//	U4  (*getOpKind)( AST astIndex );
	BOOL (*isNop)(AST astIndex);
	BOOL (*isReturn)(AST astIndex);
	BOOL (*isSelectValueByCondition)(AST astIndex);
	BOOL (*isSelectValueByConditionEnd)(AST astIndex);
	BOOL (*isMultiInputJoinPoint)(AST astIndex);
	BOOL (*isJump)(AST astIndex);
	BOOL (*isJudge)(AST astIndex);
	BOOL (*isSelectPathByCondition)(AST astIndex);
	BOOL (*isFunctionEntry)(AST astIndex);
	BOOL (*isFunctionExit)(AST astIndex);
	BOOL (*isGetOperandValue)(AST astIndex);
	BOOL (*isGetOffsetByUnit)(AST astIndex);
	BOOL (*isGetOffsetByByte)(AST astIndex);
	BOOL (*isIndirectReference)(AST astIndex);
	BOOL (*isGetAddress)(AST astIndex);
	BOOL (*isCallFunction)(AST astIndex);
	BOOL (*isIncrement)(AST astIndex);
	BOOL (*isDecrement)(AST astIndex);
	BOOL (*isSingleMinus)(AST astIndex);
	BOOL (*isBooleanNegation)(AST astIndex);
	BOOL (*isBitNegation)(AST astIndex);
	BOOL (*isCast)(AST astIndex);
	BOOL (*isMultiplication)(AST astIndex);
	BOOL (*isDivision)(AST astIndex);
	BOOL (*isGetRemainder)(AST astIndex);
	BOOL (*isAddition)(AST astIndex);
	BOOL (*isSubtraction)(AST astIndex);
	BOOL (*isLeftShift)(AST astIndex);
	BOOL (*isRightShift)(AST astIndex);
	BOOL (*isGreaterThan)(AST astIndex);
	BOOL (*isGreaterThanOrEqual)(AST astIndex);
	BOOL (*isLessThan)(AST astIndex);
	BOOL (*isLessThanOrEqual)(AST astIndex);
	BOOL (*isEqualTo)(AST astIndex);
	BOOL (*isNotEqualTo)(AST astIndex);
	BOOL (*isBitAnd)(AST astIndex);
	BOOL (*isBitExclusiveOr)(AST astIndex);
	BOOL (*isBitInclusiveOr)(AST astIndex);
	BOOL (*isLogicalAnd)(AST astIndex);
	BOOL (*isLogicalOr)(AST astIndex);
	BOOL (*isAssignTo)(AST astIndex);
	BOOL (*isSendArgument)(AST astIndex);
	AST (*getCodeScope)(AST astIndex);
	AST (*getType)(AST astIndex);
	AST (*getLeftOperand)(AST astIndex);
	AST (*getRightOperand)(AST astIndex);
	AST (*getNext)(AST astIndex);
	AST (*getPrev)(AST astIndex);
	AST (*getNextByPath)(AST astIndex, BOOL bCondition);
	AST (*getFunction)(AST astIndex);
#ifdef RECORD_CMDLIST_LABEL
	PSZ (*getCommandLabel)(AST astIndex);
#endif
} TYPE_COMMANDLIST;
extern TYPE_COMMANDLIST LinkCommandList;

typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isVariable)(AST);
	BOOL (*isFunction)(AST);
	BOOL (*isCommandList)(AST);
	BOOL (*isConstant)(AST);
	BOOL (*isConstString)(AST);
	AST (*getParameter)(AST);
} TYPE_OPERAND;
extern TYPE_OPERAND LinkOperand;
typedef struct {
	AST (*getMax)(VOID);
	BOOL (*isBasicType)(AST astIndex);
	BOOL (*isArray)(AST astIndex);
	BOOL (*isPointer)(AST astIndex);
	BOOL (*isFunction)(AST astIndex);
	BOOL (*isStruct)(AST astIndex);
	BOOL (*isUnion)(AST astIndex);
	BOOL (*isEnum)(AST astIndex);
	BOOL (*isBitfield)(AST astIndex);
	BOOL (*isSigned)(AST astIndex);
	BOOL (*isUnSigned)(AST astIndex);
	BOOL (*isLongLong)(AST astIndex);
	BOOL (*isLong)(AST astIndex);
	BOOL (*isShort)(AST astIndex);
	BOOL (*isInteger)(AST astIndex);
	BOOL (*isFloating)(AST astIndex);
	BOOL (*isConst)(AST astIndex);
	BOOL (*isVolatile)(AST astIndex);
	BOOL (*isRestrict)(AST astIndex);
	U4 (*getTypeSize)(AST astIndex);
	AST (*getElementType)(AST astIndex);
	AST (*getNoneQualifierType)(AST astIndex);
	AST (*getMemberChain)(AST astIndex);
	PSZ (*getTagInfo)(AST astIndex);
} TYPE_LINKTYPEINFO;
extern TYPE_LINKTYPEINFO LinkTypeInfo;

typedef struct _LINK_OUTPUT_FUNCTIONS {
//	TYPE_TRANSLATIONUNIT * LinkTranslationUnit;
	TYPE_STRINGS * LinkStrings;
	TYPE_LINKTYPEINFO * LinkTypeInfo;
	TYPE_MEMBERINFO * LinkMember;
	TYPE_CONSTANTINFO * LinkConstant;
	TYPE_GBLLINKAGE * LinkLinkage;
	TYPE_VARIABLE * LinkVariable;
	TYPE_FUNCTION * LinkFunction;
	TYPE_COMMANDLIST * LinkCommandList;
	TYPE_OPERAND *LinkOperand;
} LINK_OUTPUT_FUNCTIONS;
extern const LINK_OUTPUT_FUNCTIONS LinkOutput;
typedef struct {
	AST (*getPathInfoOfFunction)(PSZ function, PSZ fileName);
	BOOL (*getPathCondition)(AST astPath);
	U2 (*getTotalTracedTimes)(AST astPath);
	BOOL (*isExecutable)(AST astPath);
	AST (*getBeginCommand)(AST astPath);
	AST (*getEndCommand)(AST astPath);
	AST (*getBackwardPath)(AST astPath);
	AST (*getForwardPath)(AST astPath);
	AST (*getParallelPathForward)(AST astPath);
	AST (*getParallelPathBackward)(AST astPath);
	AST (*getLoopInfo)(AST astPath);
} TYPE_TRACEPATHINFO;
extern TYPE_TRACEPATHINFO TracePathInfo;
typedef struct {
	AST (*getLoopInfo)(AST astPath);
	AST (*getPathInfo)(AST astPath);
	AST (*getInputPath)(AST astPath);
	AST (*getOutputPath)(AST astPath);
} TYPE_TRACECOMMANDLISTMETADATA;
extern TYPE_TRACECOMMANDLISTMETADATA TraceCmdListMetaData;
typedef struct {
	AST (*getEntryPath)(AST astPath);
	AST (*getParentLoop)(AST astPath);
} TYPE_TRACELOOPINFO;
extern TYPE_TRACELOOPINFO TraceLoopInfo;

extern S4 CCoreStart(VOID);
extern VOID CCoreTerminate(VOID);

extern S4 CCoreCC(PSZ pszSrc, BOOL bCompile);

extern S4 CPreprocessing(PSZ pszSrc);
extern S4 CSyntaxProcessing(VOID);
extern S4 CGProcessing(AST astTu);

extern S4 LinkageSetting(VOID);

extern VOID ClearCoreCCResult(VOID);
extern VOID ClearTUPreprocessingResult(VOID);
extern VOID ClearTUSyntaxProcessingResult(VOID);

extern S4 CCoreAddOpt(PSZ pszOptKey, PSZ pszOptPrm);
extern S4 CCoreAddOptByString(PSZ pszOptKey);
extern U4 CCoreGetMemoryMaxSize(VOID);
extern U4 CCoreGetMemoryCurrentSize(VOID);
extern VOID CCoreReleaseUnusedMem(VOID);

extern S4 Tr_CmdAddFunctionEntry(PSZ);
extern S4 Tr_CmdTraceAllEntries(S4 (*pfunc)(AST, U4), AST (*getCallee)(AST));
/*debug,12/10/15,S*/
extern S4 Tr_CmdCleanEntry(VOID);
/*debug,12/10/15,E*/
extern VOID Tr_CmdAddCallBackEvent(PSZ event);
extern VOID Tr_CmdAddOption(PSZ option);

extern PSZ Convert2CppResultFile(CHAR * cFilename, CHAR * cppFilename);
//extern VOID DumpCodeScopeToFile( PSZ szPath, PSZ postfix );
//extern VOID DumpDeclaration( PSZ szPath, PSZ postfix );
//extern VOID DumpDeclarator(  PSZ szPath, PSZ postfix );
//extern VOID DumpExpression( PSZ szPath, PSZ postfix );
//extern VOID DumpStatement ( PSZ szPath, PSZ postfix );
//extern VOID DumpType( PSZ szPath, PSZ postfix );
//extern VOID DumpTypeSpecifier(  PSZ szPath, PSZ postfix );
//extern VOID DumpPPTokenList( PSZ szPath, PSZ postfix );
//extern VOID DumpDirective( PSZ szPath, PSZ postfix );
//extern VOID DumpRepListToken( PSZ szPath, PSZ postfix );
//extern VOID DumpPPCondExp( PSZ szPath, PSZ postfix );
//extern VOID DumpMacroInfo( PSZ szPath, PSZ postfix );
//extern VOID DumpConstant( PSZ szPath, PSZ postfix );
#endif
